<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

class CreateWithdrawsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('withdraws', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('user_id')->comment('用户id');
            $table->tinyInteger('speed')->default(0)->comment('1快速5%2普通3%');            
            $table->tinyInteger('channel')->default(0)->comment('提现渠道1余额提现2店铺收益提现');            
            $table->string('partner_trade_no')->default('')->unique()->comment('商户订单号');            
            $table->string('payment_no')->default('')->comment('微信交易单号');
            $table->dateTime('paid_at')->nullable()->comment('付款时间');                        
            $table->decimal('money',16,2)->comment('用户id');
            $table->integer('type')->comment('提现方式0人工充值1微信2支付宝3银行卡');
            $table->integer('status')->comment('提现状态0待审核1已完成(审核通过)2已取消3审核不通过');
            $table->string('comment')->default('')->comment('备注');
            $table->timestamps();
        });

        DB::statement("ALTER TABLE `withdraws` comment '提现记录表';");

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('withdraws');
    }
}
